import isPrefixedValue from 'css-in-js-utils/lib/isPrefixedValue'

const prefixes = ['-webkit-', '-moz-', '']
const values = /linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/gi

export default function gradient(property, value) {
  if (
    typeof value === 'string' &&
    !isPrefixedValue(value) &&
    values.test(value)
  ) {
    return prefixes.map((prefix) =>
      value.replace(values, (grad) => prefix + grad)
    )
  }
}
